<?php
	function convert2JPG($png_src,$jpg_src){
		//jpg_src la duong dan dich den chua file jpg sau khi da convert
		$image = imagecreatefrompng($png_src);
		$bg = imagecreatetruecolor(imagesx($image), imagesy($image));
		imagefill($bg, 0, 0, imagecolorallocate($bg, 255, 255, 255));
		imagealphablending($bg, TRUE);
		imagecopy($bg, $image, 0, 0, 0, 0, imagesx($image), imagesy($image));
		imagedestroy($image);
		$quality = 80; // 0 = worst / smaller file, 100 = better / bigger file 
		imagejpeg($bg, $jpg_src, $quality);
		ImageDestroy($bg);
	}
?>